package com.wyp168.jse;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName Teat
 * @Description TODO
 * @Author wyp168
 * @Date 2022/7/8 14:41
 */
public class Test {
    public static void main(String[] args) {
//        List<Integer> list = Arrays.asList(1, 2, 3);
//
//        list.add(1);

        ObjectA objA = new ObjectA("张三", 18, "男");

        Test test = new Test();

        ObjectA objectA = test.tryChangeObjectValue(objA);

        System.out.println("source objA's name value: " + objA.getName() + ", target objA's name value: " + objectA.getName());

        System.out.println("source objA == target objA ? " + (objA == objectA));


    }
    public ObjectA tryChangeObjectValue(ObjectA obj) {
        obj.setName(obj.getName() + "111");
        return obj;
    }
}


class ObjectA {
    private String name;
    private Integer age;
    private String sex;

    public ObjectA(String name, Integer age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public ObjectA() {
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "ObjectA{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }
}
